<?php


namespace Wyi\WebWechat\request;


use GuzzleHttp\Client;

class Request
{
    /**
     * @var Client
     */
    protected $client;

    /**
     * Request constructor.
     */
    public function __construct(Client $client)
    {
        $this->client = $client;
    }

    public function sendPost(string $uri, array $data = [], array $header = [])
    {
        $option = [
            'body' => $data,
            'headers' => $header
        ];
        $this->client->post($uri,$option);
    }

    /**
     * @param string $uri
     * @return \Psr\Http\Message\ResponseInterface
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    public function sendGet(string $uri, array $header = [])
    {
        $header['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36';
        $option = [
            'headers' => $header
        ];
        return $this->client->get($uri, $option ?? []);
    }

}